{
  "cells": [
    {
      "cell_type": "markdown",
      "source": [
        "# Neural Networks Classification"
      ],
      "metadata": {}
    },
    {
      "cell_type": "code",
      "source": [
        "import numpy as np\n",
        "import pandas as pd\n",
        "import matplotlib.pyplot as plt\n",
        "\n",
        "import warnings\n",
        "warnings.filterwarnings(\"ignore\")\n",
        "\n",
        "# fix_yahoo_finance is used to fetch data \n",
        "import fix_yahoo_finance as yf\n",
        "yf.pdr_override()"
      ],
      "outputs": [],
      "execution_count": 1,
      "metadata": {
        "collapsed": false,
        "outputHidden": false,
        "inputHidden": false
      }
    },
    {
      "cell_type": "code",
      "source": [
        "# input\n",
        "symbol = 'AMD'\n",
        "start = '2014-01-01'\n",
        "end = '2018-08-27'\n",
        "\n",
        "# Read data \n",
        "dataset = yf.download(symbol,start,end)\n",
        "\n",
        "# View Columns\n",
        "dataset.head()"
      ],
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "[*********************100%***********************]  1 of 1 downloaded\n"
          ]
        },
        {
          "output_type": "execute_result",
          "execution_count": 2,
          "data": {
            "text/plain": [
              "            Open  High   Low  Close  Adj Close    Volume\n",
              "Date                                                    \n",
              "2014-01-02  3.85  3.98  3.84   3.95       3.95  20548400\n",
              "2014-01-03  3.98  4.00  3.88   4.00       4.00  22887200\n",
              "2014-01-06  4.01  4.18  3.99   4.13       4.13  42398300\n",
              "2014-01-07  4.19  4.25  4.11   4.18       4.18  42932100\n",
              "2014-01-08  4.23  4.26  4.14   4.18       4.18  30678700"
            ],
            "text/html": [
              "<div>\n",
              "<style scoped>\n",
              "    .dataframe tbody tr th:only-of-type {\n",
              "        vertical-align: middle;\n",
              "    }\n",
              "\n",
              "    .dataframe tbody tr th {\n",
              "        vertical-align: top;\n",
              "    }\n",
              "\n",
              "    .dataframe thead th {\n",
              "        text-align: right;\n",
              "    }\n",
              "</style>\n",
              "<table border=\"1\" class=\"dataframe\">\n",
              "  <thead>\n",
              "    <tr style=\"text-align: right;\">\n",
              "      <th></th>\n",
              "      <th>Open</th>\n",
              "      <th>High</th>\n",
              "      <th>Low</th>\n",
              "      <th>Close</th>\n",
              "      <th>Adj Close</th>\n",
              "      <th>Volume</th>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>Date</th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "    </tr>\n",
              "  </thead>\n",
              "  <tbody>\n",
              "    <tr>\n",
              "      <th>2014-01-02</th>\n",
              "      <td>3.85</td>\n",
              "      <td>3.98</td>\n",
              "      <td>3.84</td>\n",
              "      <td>3.95</td>\n",
              "      <td>3.95</td>\n",
              "      <td>20548400</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>2014-01-03</th>\n",
              "      <td>3.98</td>\n",
              "      <td>4.00</td>\n",
              "      <td>3.88</td>\n",
              "      <td>4.00</td>\n",
              "      <td>4.00</td>\n",
              "      <td>22887200</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>2014-01-06</th>\n",
              "      <td>4.01</td>\n",
              "      <td>4.18</td>\n",
              "      <td>3.99</td>\n",
              "      <td>4.13</td>\n",
              "      <td>4.13</td>\n",
              "      <td>42398300</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>2014-01-07</th>\n",
              "      <td>4.19</td>\n",
              "      <td>4.25</td>\n",
              "      <td>4.11</td>\n",
              "      <td>4.18</td>\n",
              "      <td>4.18</td>\n",
              "      <td>42932100</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>2014-01-08</th>\n",
              "      <td>4.23</td>\n",
              "      <td>4.26</td>\n",
              "      <td>4.14</td>\n",
              "      <td>4.18</td>\n",
              "      <td>4.18</td>\n",
              "      <td>30678700</td>\n",
              "    </tr>\n",
              "  </tbody>\n",
              "</table>\n",
              "</div>"
            ]
          },
          "metadata": {}
        }
      ],
      "execution_count": 2,
      "metadata": {
        "collapsed": false,
        "outputHidden": false,
        "inputHidden": false
      }
    },
    {
      "cell_type": "code",
      "source": [
        "dataset = dataset.reset_index()\n",
        "dataset.head()"
      ],
      "outputs": [
        {
          "output_type": "execute_result",
          "execution_count": 3,
          "data": {
            "text/plain": [
              "        Date  Open  High   Low  Close  Adj Close    Volume\n",
              "0 2014-01-02  3.85  3.98  3.84   3.95       3.95  20548400\n",
              "1 2014-01-03  3.98  4.00  3.88   4.00       4.00  22887200\n",
              "2 2014-01-06  4.01  4.18  3.99   4.13       4.13  42398300\n",
              "3 2014-01-07  4.19  4.25  4.11   4.18       4.18  42932100\n",
              "4 2014-01-08  4.23  4.26  4.14   4.18       4.18  30678700"
            ],
            "text/html": [
              "<div>\n",
              "<style scoped>\n",
              "    .dataframe tbody tr th:only-of-type {\n",
              "        vertical-align: middle;\n",
              "    }\n",
              "\n",
              "    .dataframe tbody tr th {\n",
              "        vertical-align: top;\n",
              "    }\n",
              "\n",
              "    .dataframe thead th {\n",
              "        text-align: right;\n",
              "    }\n",
              "</style>\n",
              "<table border=\"1\" class=\"dataframe\">\n",
              "  <thead>\n",
              "    <tr style=\"text-align: right;\">\n",
              "      <th></th>\n",
              "      <th>Date</th>\n",
              "      <th>Open</th>\n",
              "      <th>High</th>\n",
              "      <th>Low</th>\n",
              "      <th>Close</th>\n",
              "      <th>Adj Close</th>\n",
              "      <th>Volume</th>\n",
              "    </tr>\n",
              "  </thead>\n",
              "  <tbody>\n",
              "    <tr>\n",
              "      <th>0</th>\n",
              "      <td>2014-01-02</td>\n",
              "      <td>3.85</td>\n",
              "      <td>3.98</td>\n",
              "      <td>3.84</td>\n",
              "      <td>3.95</td>\n",
              "      <td>3.95</td>\n",
              "      <td>20548400</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>1</th>\n",
              "      <td>2014-01-03</td>\n",
              "      <td>3.98</td>\n",
              "      <td>4.00</td>\n",
              "      <td>3.88</td>\n",
              "      <td>4.00</td>\n",
              "      <td>4.00</td>\n",
              "      <td>22887200</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>2</th>\n",
              "      <td>2014-01-06</td>\n",
              "      <td>4.01</td>\n",
              "      <td>4.18</td>\n",
              "      <td>3.99</td>\n",
              "      <td>4.13</td>\n",
              "      <td>4.13</td>\n",
              "      <td>42398300</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>3</th>\n",
              "      <td>2014-01-07</td>\n",
              "      <td>4.19</td>\n",
              "      <td>4.25</td>\n",
              "      <td>4.11</td>\n",
              "      <td>4.18</td>\n",
              "      <td>4.18</td>\n",
              "      <td>42932100</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>4</th>\n",
              "      <td>2014-01-08</td>\n",
              "      <td>4.23</td>\n",
              "      <td>4.26</td>\n",
              "      <td>4.14</td>\n",
              "      <td>4.18</td>\n",
              "      <td>4.18</td>\n",
              "      <td>30678700</td>\n",
              "    </tr>\n",
              "  </tbody>\n",
              "</table>\n",
              "</div>"
            ]
          },
          "metadata": {}
        }
      ],
      "execution_count": 3,
      "metadata": {
        "collapsed": false,
        "outputHidden": false,
        "inputHidden": false
      }
    },
    {
      "cell_type": "code",
      "source": [
        "dataset['Increase_Decrease'] = np.where(dataset['Volume'].shift(-1) > dataset['Volume'],1,0)\n",
        "dataset['Buy_Sell_on_Open'] = np.where(dataset['Open'].shift(-1) > dataset['Open'],1,0)\n",
        "dataset['Buy_Sell'] = np.where(dataset['Adj Close'].shift(-1) > dataset['Adj Close'],1,0)\n",
        "dataset['Returns'] = dataset['Adj Close'].pct_change()\n",
        "dataset = dataset.dropna()"
      ],
      "outputs": [],
      "execution_count": 4,
      "metadata": {
        "collapsed": false,
        "outputHidden": false,
        "inputHidden": false
      }
    },
    {
      "cell_type": "markdown",
      "source": [
        "Data Exploration"
      ],
      "metadata": {}
    },
    {
      "cell_type": "code",
      "source": [
        "dataset.head()"
      ],
      "outputs": [
        {
          "output_type": "execute_result",
          "execution_count": 5,
          "data": {
            "text/plain": [
              "        Date  Open  High   Low  Close  Adj Close    Volume  Increase_Decrease  \\\n",
              "1 2014-01-03  3.98  4.00  3.88   4.00       4.00  22887200                  1   \n",
              "2 2014-01-06  4.01  4.18  3.99   4.13       4.13  42398300                  1   \n",
              "3 2014-01-07  4.19  4.25  4.11   4.18       4.18  42932100                  0   \n",
              "4 2014-01-08  4.23  4.26  4.14   4.18       4.18  30678700                  0   \n",
              "5 2014-01-09  4.20  4.23  4.05   4.09       4.09  30667600                  0   \n",
              "\n",
              "   Buy_Sell_on_Open  Buy_Sell   Returns  \n",
              "1                 1         1  0.012658  \n",
              "2                 1         1  0.032500  \n",
              "3                 1         0  0.012107  \n",
              "4                 0         0  0.000000  \n",
              "5                 0         1 -0.021531  "
            ],
            "text/html": [
              "<div>\n",
              "<style scoped>\n",
              "    .dataframe tbody tr th:only-of-type {\n",
              "        vertical-align: middle;\n",
              "    }\n",
              "\n",
              "    .dataframe tbody tr th {\n",
              "        vertical-align: top;\n",
              "    }\n",
              "\n",
              "    .dataframe thead th {\n",
              "        text-align: right;\n",
              "    }\n",
              "</style>\n",
              "<table border=\"1\" class=\"dataframe\">\n",
              "  <thead>\n",
              "    <tr style=\"text-align: right;\">\n",
              "      <th></th>\n",
              "      <th>Date</th>\n",
              "      <th>Open</th>\n",
              "      <th>High</th>\n",
              "      <th>Low</th>\n",
              "      <th>Close</th>\n",
              "      <th>Adj Close</th>\n",
              "      <th>Volume</th>\n",
              "      <th>Increase_Decrease</th>\n",
              "      <th>Buy_Sell_on_Open</th>\n",
              "      <th>Buy_Sell</th>\n",
              "      <th>Returns</th>\n",
              "    </tr>\n",
              "  </thead>\n",
              "  <tbody>\n",
              "    <tr>\n",
              "      <th>1</th>\n",
              "      <td>2014-01-03</td>\n",
              "      <td>3.98</td>\n",
              "      <td>4.00</td>\n",
              "      <td>3.88</td>\n",
              "      <td>4.00</td>\n",
              "      <td>4.00</td>\n",
              "      <td>22887200</td>\n",
              "      <td>1</td>\n",
              "      <td>1</td>\n",
              "      <td>1</td>\n",
              "      <td>0.012658</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>2</th>\n",
              "      <td>2014-01-06</td>\n",
              "      <td>4.01</td>\n",
              "      <td>4.18</td>\n",
              "      <td>3.99</td>\n",
              "      <td>4.13</td>\n",
              "      <td>4.13</td>\n",
              "      <td>42398300</td>\n",
              "      <td>1</td>\n",
              "      <td>1</td>\n",
              "      <td>1</td>\n",
              "      <td>0.032500</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>3</th>\n",
              "      <td>2014-01-07</td>\n",
              "      <td>4.19</td>\n",
              "      <td>4.25</td>\n",
              "      <td>4.11</td>\n",
              "      <td>4.18</td>\n",
              "      <td>4.18</td>\n",
              "      <td>42932100</td>\n",
              "      <td>0</td>\n",
              "      <td>1</td>\n",
              "      <td>0</td>\n",
              "      <td>0.012107</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>4</th>\n",
              "      <td>2014-01-08</td>\n",
              "      <td>4.23</td>\n",
              "      <td>4.26</td>\n",
              "      <td>4.14</td>\n",
              "      <td>4.18</td>\n",
              "      <td>4.18</td>\n",
              "      <td>30678700</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0.000000</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>5</th>\n",
              "      <td>2014-01-09</td>\n",
              "      <td>4.20</td>\n",
              "      <td>4.23</td>\n",
              "      <td>4.05</td>\n",
              "      <td>4.09</td>\n",
              "      <td>4.09</td>\n",
              "      <td>30667600</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>1</td>\n",
              "      <td>-0.021531</td>\n",
              "    </tr>\n",
              "  </tbody>\n",
              "</table>\n",
              "</div>"
            ]
          },
          "metadata": {}
        }
      ],
      "execution_count": 5,
      "metadata": {
        "collapsed": false,
        "outputHidden": false,
        "inputHidden": false
      }
    },
    {
      "cell_type": "code",
      "source": [
        "dataset.tail()"
      ],
      "outputs": [
        {
          "output_type": "execute_result",
          "execution_count": 6,
          "data": {
            "text/plain": [
              "           Date       Open       High        Low      Close  Adj Close  \\\n",
              "1167 2018-08-21  19.980000  20.420000  19.860001  20.400000  20.400000   \n",
              "1168 2018-08-22  20.280001  20.920000  20.209999  20.900000  20.900000   \n",
              "1169 2018-08-23  21.190001  22.320000  21.139999  22.290001  22.290001   \n",
              "1170 2018-08-24  22.910000  24.000000  22.670000  23.980000  23.980000   \n",
              "1171 2018-08-27  24.940001  27.299999  24.629999  25.260000  25.260000   \n",
              "\n",
              "         Volume  Increase_Decrease  Buy_Sell_on_Open  Buy_Sell   Returns  \n",
              "1167   55629000                  1                 1         1  0.021021  \n",
              "1168   62002700                  1                 1         1  0.024510  \n",
              "1169  113444100                  1                 1         1  0.066507  \n",
              "1170  164328200                  1                 1         1  0.075819  \n",
              "1171  325058400                  0                 0         0  0.053378  "
            ],
            "text/html": [
              "<div>\n",
              "<style scoped>\n",
              "    .dataframe tbody tr th:only-of-type {\n",
              "        vertical-align: middle;\n",
              "    }\n",
              "\n",
              "    .dataframe tbody tr th {\n",
              "        vertical-align: top;\n",
              "    }\n",
              "\n",
              "    .dataframe thead th {\n",
              "        text-align: right;\n",
              "    }\n",
              "</style>\n",
              "<table border=\"1\" class=\"dataframe\">\n",
              "  <thead>\n",
              "    <tr style=\"text-align: right;\">\n",
              "      <th></th>\n",
              "      <th>Date</th>\n",
              "      <th>Open</th>\n",
              "      <th>High</th>\n",
              "      <th>Low</th>\n",
              "      <th>Close</th>\n",
              "      <th>Adj Close</th>\n",
              "      <th>Volume</th>\n",
              "      <th>Increase_Decrease</th>\n",
              "      <th>Buy_Sell_on_Open</th>\n",
              "      <th>Buy_Sell</th>\n",
              "      <th>Returns</th>\n",
              "    </tr>\n",
              "  </thead>\n",
              "  <tbody>\n",
              "    <tr>\n",
              "      <th>1167</th>\n",
              "      <td>2018-08-21</td>\n",
              "      <td>19.980000</td>\n",
              "      <td>20.420000</td>\n",
              "      <td>19.860001</td>\n",
              "      <td>20.400000</td>\n",
              "      <td>20.400000</td>\n",
              "      <td>55629000</td>\n",
              "      <td>1</td>\n",
              "      <td>1</td>\n",
              "      <td>1</td>\n",
              "      <td>0.021021</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>1168</th>\n",
              "      <td>2018-08-22</td>\n",
              "      <td>20.280001</td>\n",
              "      <td>20.920000</td>\n",
              "      <td>20.209999</td>\n",
              "      <td>20.900000</td>\n",
              "      <td>20.900000</td>\n",
              "      <td>62002700</td>\n",
              "      <td>1</td>\n",
              "      <td>1</td>\n",
              "      <td>1</td>\n",
              "      <td>0.024510</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>1169</th>\n",
              "      <td>2018-08-23</td>\n",
              "      <td>21.190001</td>\n",
              "      <td>22.320000</td>\n",
              "      <td>21.139999</td>\n",
              "      <td>22.290001</td>\n",
              "      <td>22.290001</td>\n",
              "      <td>113444100</td>\n",
              "      <td>1</td>\n",
              "      <td>1</td>\n",
              "      <td>1</td>\n",
              "      <td>0.066507</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>1170</th>\n",
              "      <td>2018-08-24</td>\n",
              "      <td>22.910000</td>\n",
              "      <td>24.000000</td>\n",
              "      <td>22.670000</td>\n",
              "      <td>23.980000</td>\n",
              "      <td>23.980000</td>\n",
              "      <td>164328200</td>\n",
              "      <td>1</td>\n",
              "      <td>1</td>\n",
              "      <td>1</td>\n",
              "      <td>0.075819</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>1171</th>\n",
              "      <td>2018-08-27</td>\n",
              "      <td>24.940001</td>\n",
              "      <td>27.299999</td>\n",
              "      <td>24.629999</td>\n",
              "      <td>25.260000</td>\n",
              "      <td>25.260000</td>\n",
              "      <td>325058400</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0.053378</td>\n",
              "    </tr>\n",
              "  </tbody>\n",
              "</table>\n",
              "</div>"
            ]
          },
          "metadata": {}
        }
      ],
      "execution_count": 6,
      "metadata": {
        "collapsed": false,
        "outputHidden": false,
        "inputHidden": false
      }
    },
    {
      "cell_type": "code",
      "source": [
        "dataset.dtypes"
      ],
      "outputs": [
        {
          "output_type": "execute_result",
          "execution_count": 7,
          "data": {
            "text/plain": [
              "Date                 datetime64[ns]\n",
              "Open                        float64\n",
              "High                        float64\n",
              "Low                         float64\n",
              "Close                       float64\n",
              "Adj Close                   float64\n",
              "Volume                        int32\n",
              "Increase_Decrease             int32\n",
              "Buy_Sell_on_Open              int32\n",
              "Buy_Sell                      int32\n",
              "Returns                     float64\n",
              "dtype: object"
            ]
          },
          "metadata": {}
        }
      ],
      "execution_count": 7,
      "metadata": {
        "collapsed": false,
        "outputHidden": false,
        "inputHidden": false
      }
    },
    {
      "cell_type": "code",
      "source": [
        "from sklearn.neural_network import MLPClassifier"
      ],
      "outputs": [],
      "execution_count": 8,
      "metadata": {
        "collapsed": false,
        "outputHidden": false,
        "inputHidden": false
      }
    },
    {
      "cell_type": "code",
      "source": [
        "X = dataset.drop(['Date','Buy_Sell'],axis=1)\n",
        "y = dataset['Buy_Sell']"
      ],
      "outputs": [],
      "execution_count": 13,
      "metadata": {
        "collapsed": false,
        "outputHidden": false,
        "inputHidden": false
      }
    },
    {
      "cell_type": "code",
      "source": [
        "from sklearn.model_selection import train_test_split\n",
        "\n",
        "X_train, X_test, y_train, y_test = train_test_split(X, y)"
      ],
      "outputs": [],
      "execution_count": 14,
      "metadata": {
        "collapsed": false,
        "outputHidden": false,
        "inputHidden": false
      }
    },
    {
      "cell_type": "code",
      "source": [
        "from sklearn.preprocessing import StandardScaler\n",
        "\n",
        "scaler = StandardScaler()"
      ],
      "outputs": [],
      "execution_count": 11,
      "metadata": {
        "collapsed": false,
        "outputHidden": false,
        "inputHidden": false
      }
    },
    {
      "cell_type": "code",
      "source": [
        "# Fit only to the training data\n",
        "scaler.fit(X_train)"
      ],
      "outputs": [
        {
          "output_type": "execute_result",
          "execution_count": 15,
          "data": {
            "text/plain": [
              "StandardScaler(copy=True, with_mean=True, with_std=True)"
            ]
          },
          "metadata": {}
        }
      ],
      "execution_count": 15,
      "metadata": {
        "collapsed": false,
        "outputHidden": false,
        "inputHidden": false
      }
    },
    {
      "cell_type": "code",
      "source": [
        "X_train = scaler.transform(X_train)\n",
        "X_test = scaler.transform(X_test)"
      ],
      "outputs": [],
      "execution_count": 16,
      "metadata": {
        "collapsed": false,
        "outputHidden": false,
        "inputHidden": false
      }
    },
    {
      "cell_type": "code",
      "source": [
        "mlp = MLPClassifier(hidden_layer_sizes=(13,13,13),max_iter=500)"
      ],
      "outputs": [],
      "execution_count": 17,
      "metadata": {
        "collapsed": false,
        "outputHidden": false,
        "inputHidden": false
      }
    },
    {
      "cell_type": "code",
      "source": [
        "mlp.fit(X_train,y_train)"
      ],
      "outputs": [
        {
          "output_type": "execute_result",
          "execution_count": 18,
          "data": {
            "text/plain": [
              "MLPClassifier(activation='relu', alpha=0.0001, batch_size='auto', beta_1=0.9,\n",
              "       beta_2=0.999, early_stopping=False, epsilon=1e-08,\n",
              "       hidden_layer_sizes=(13, 13, 13), learning_rate='constant',\n",
              "       learning_rate_init=0.001, max_iter=500, momentum=0.9,\n",
              "       nesterovs_momentum=True, power_t=0.5, random_state=None,\n",
              "       shuffle=True, solver='adam', tol=0.0001, validation_fraction=0.1,\n",
              "       verbose=False, warm_start=False)"
            ]
          },
          "metadata": {}
        }
      ],
      "execution_count": 18,
      "metadata": {
        "collapsed": false,
        "outputHidden": false,
        "inputHidden": false
      }
    },
    {
      "cell_type": "markdown",
      "source": [
        "Predictions and Evaluation"
      ],
      "metadata": {}
    },
    {
      "cell_type": "code",
      "source": [
        "predictions = mlp.predict(X_test)"
      ],
      "outputs": [],
      "execution_count": 19,
      "metadata": {
        "collapsed": false,
        "outputHidden": false,
        "inputHidden": false
      }
    },
    {
      "cell_type": "code",
      "source": [
        "from sklearn.metrics import classification_report,confusion_matrix\n",
        "\n",
        "\n",
        "print(confusion_matrix(y_test,predictions))"
      ],
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "[[92 46]\n",
            " [73 82]]\n"
          ]
        }
      ],
      "execution_count": 20,
      "metadata": {
        "collapsed": false,
        "outputHidden": false,
        "inputHidden": false
      }
    },
    {
      "cell_type": "code",
      "source": [
        "print(classification_report(y_test,predictions))"
      ],
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "             precision    recall  f1-score   support\n",
            "\n",
            "          0       0.56      0.67      0.61       138\n",
            "          1       0.64      0.53      0.58       155\n",
            "\n",
            "avg / total       0.60      0.59      0.59       293\n",
            "\n"
          ]
        }
      ],
      "execution_count": 21,
      "metadata": {
        "collapsed": false,
        "outputHidden": false,
        "inputHidden": false
      }
    },
    {
      "cell_type": "code",
      "source": [
        "len(mlp.coefs_)"
      ],
      "outputs": [
        {
          "output_type": "execute_result",
          "execution_count": 22,
          "data": {
            "text/plain": [
              "4"
            ]
          },
          "metadata": {}
        }
      ],
      "execution_count": 22,
      "metadata": {
        "collapsed": false,
        "outputHidden": false,
        "inputHidden": false
      }
    },
    {
      "cell_type": "code",
      "source": [
        "mlp.coefs_"
      ],
      "outputs": [
        {
          "output_type": "execute_result",
          "execution_count": 23,
          "data": {
            "text/plain": [
              "[array([[-0.1881383 ,  0.06936781,  0.25132071,  0.54200624,  0.24556997,\n",
              "          0.04277295,  0.17382716, -0.46497638, -0.21438311,  0.18281472,\n",
              "          0.15372843, -0.02028545, -0.52916784],\n",
              "        [ 0.21992635, -0.00838443,  0.15562097, -0.40814875, -0.0787755 ,\n",
              "          0.24326174,  0.15224143, -0.34738608, -0.12321794, -0.15675869,\n",
              "          0.03130395, -0.27681512,  0.22712127],\n",
              "        [-0.43183095,  0.19240544, -0.25027285, -0.35697896, -0.17613975,\n",
              "          0.1664433 ,  0.04653116, -0.02330485,  0.54639837,  0.20604981,\n",
              "         -0.18547052,  0.04349312,  0.32171182],\n",
              "        [ 0.07242393, -0.36008638, -0.4151522 , -0.15397501,  0.47022404,\n",
              "         -0.11808914, -0.3989602 ,  0.05111261,  0.01755496, -0.44579156,\n",
              "          0.16990582,  0.22563828,  0.24117851],\n",
              "        [-0.18798663,  0.1655963 , -0.19847794, -0.28466721, -0.03540747,\n",
              "         -0.34743287, -0.23462429,  0.31911658, -0.05346275,  0.48205172,\n",
              "          0.40541368, -0.46273255,  0.0809665 ],\n",
              "        [-0.44612396, -0.11779751,  0.10020353, -0.17426744, -0.13106907,\n",
              "          0.51238328,  0.19844734,  0.24572122,  0.33676495, -0.40597193,\n",
              "         -0.59210846, -0.29130667,  0.05309978],\n",
              "        [-0.12719669, -0.10118277,  0.32934544,  0.20133818,  0.57538665,\n",
              "         -0.04702525,  0.42381986, -0.37421128, -0.21395382, -0.19378841,\n",
              "         -0.21862348,  0.49348208, -0.08246455],\n",
              "        [ 0.48985404, -0.47702491,  0.44618193,  0.47030965,  0.07480942,\n",
              "          0.10374093,  0.08835347,  0.16396706,  0.54979604, -0.39545627,\n",
              "          0.38459468,  0.2303497 ,  0.46847586],\n",
              "        [ 0.52025252,  0.42589767, -0.15763549,  0.03616224, -0.28025657,\n",
              "          0.46085595, -0.40875698,  0.17299327, -0.10760618, -0.22883535,\n",
              "         -0.29307513,  0.58527686, -0.24122097]]),\n",
              " array([[-3.33041431e-02, -3.82462859e-01,  3.28140224e-01,\n",
              "          4.88777400e-01,  3.74743318e-01,  5.34059206e-01,\n",
              "          3.15309248e-01, -1.21504755e-01, -3.32521642e-02,\n",
              "          3.96522849e-01, -8.77913200e-02, -2.55129187e-01,\n",
              "          1.90053855e-01],\n",
              "        [ 4.30102184e-01, -3.33868396e-02,  5.52194843e-01,\n",
              "          8.45030748e-03, -3.05733720e-01, -1.01374263e-01,\n",
              "         -3.07821372e-01, -3.67957687e-01, -1.36425362e-01,\n",
              "         -7.29654127e-02, -4.14776566e-01, -1.58823985e-01,\n",
              "          2.45664446e-01],\n",
              "        [ 1.54099422e-01, -2.92215767e-01, -4.12575047e-01,\n",
              "          3.15957287e-01, -2.68019025e-01,  1.40360839e-01,\n",
              "          1.55795877e-01, -5.63022418e-02,  1.21864966e-01,\n",
              "         -4.06520769e-01, -2.96294533e-02,  2.69710547e-01,\n",
              "         -2.67728318e-01],\n",
              "        [-9.69268640e-02,  7.77699928e-02,  1.64959471e-01,\n",
              "          3.51381222e-01,  7.19940556e-02,  1.17368438e-01,\n",
              "         -2.30026401e-01,  5.02931367e-02, -2.21901162e-01,\n",
              "          2.74982133e-01, -3.55457124e-01, -2.61697188e-01,\n",
              "         -2.65973979e-01],\n",
              "        [-1.99474701e-01,  4.34783644e-01, -8.45541157e-02,\n",
              "         -3.67350819e-01,  2.65379412e-01, -3.08875811e-01,\n",
              "         -2.05661964e-01, -3.70068960e-01,  1.95954778e-01,\n",
              "          3.14938858e-01,  3.81451269e-01,  1.82155149e-03,\n",
              "          3.88188953e-01],\n",
              "        [-1.73982400e-01,  2.82603230e-01,  2.61254386e-01,\n",
              "          5.45487462e-02,  1.85353337e-01,  7.40853744e-02,\n",
              "          4.60435467e-01,  5.30170557e-01, -1.32460026e-01,\n",
              "          3.46615800e-02, -5.77694262e-02, -5.78738093e-02,\n",
              "          2.17286950e-01],\n",
              "        [ 5.89351836e-02,  5.26625279e-01,  5.15720880e-01,\n",
              "          2.57686759e-01,  4.81657620e-01,  5.62868260e-01,\n",
              "         -3.61107181e-01,  5.79235428e-01,  4.04203144e-01,\n",
              "          2.72109546e-01,  1.01942596e-01, -1.11032655e-01,\n",
              "          2.41686190e-02],\n",
              "        [ 9.40436177e-02, -3.75564858e-01, -5.41099380e-01,\n",
              "          5.13322181e-01, -3.78847574e-01,  1.57323753e-01,\n",
              "          2.23830225e-02,  2.01250864e-01, -2.98224947e-01,\n",
              "          4.20853484e-01, -4.17103721e-01,  5.00648595e-03,\n",
              "          4.07867787e-02],\n",
              "        [-1.40957821e-01, -6.41244948e-01, -5.65683780e-01,\n",
              "         -9.27191233e-02, -3.87349107e-01, -5.45577481e-01,\n",
              "         -6.53884609e-02, -2.34806478e-01,  1.47277905e-01,\n",
              "         -4.93654125e-01, -4.83324550e-02,  2.64270795e-01,\n",
              "         -2.83882938e-03],\n",
              "        [-1.98926254e-01, -1.19599261e-02, -5.19125722e-01,\n",
              "         -2.22218359e-01,  5.02628492e-01,  3.11542356e-03,\n",
              "          7.65483880e-02,  4.17186539e-01, -1.69080276e-01,\n",
              "         -1.89604707e-02,  5.35722336e-01,  1.43494026e-01,\n",
              "         -6.63124830e-02],\n",
              "        [-8.74293986e-02, -3.88650038e-01,  4.50860734e-01,\n",
              "          3.52654026e-01,  1.97759973e-01,  1.78161191e-04,\n",
              "          2.31705858e-02, -4.15325827e-02, -3.87992815e-01,\n",
              "         -1.45002598e-01,  1.20536482e-01,  4.17073677e-01,\n",
              "         -5.53370090e-01],\n",
              "        [ 4.38139332e-01,  8.98992813e-02, -3.54257506e-01,\n",
              "          2.07339884e-01, -2.96225251e-01,  1.57269765e-01,\n",
              "          8.01088226e-02,  4.15375602e-01, -5.13990633e-01,\n",
              "          4.51924353e-01,  5.68026139e-01,  2.11889744e-01,\n",
              "         -2.85594110e-01],\n",
              "        [-4.32888234e-01,  1.82403666e-01,  5.32110039e-02,\n",
              "          3.40620206e-01,  4.26118415e-01, -3.36927027e-01,\n",
              "          4.16989216e-01, -1.04336300e-01, -4.62402272e-02,\n",
              "          3.63931938e-01, -1.19642176e-02,  2.16019478e-02,\n",
              "         -2.53679703e-01]]),\n",
              " array([[ 0.25082118,  0.1744807 ,  0.0099691 ,  0.12324915, -0.4127926 ,\n",
              "          0.04764578, -0.61548871, -0.52121748,  0.25675311, -0.16325481,\n",
              "         -0.36636707, -0.23080399,  0.29257002],\n",
              "        [-0.258531  ,  0.13999612, -0.56887517,  0.46614771, -0.15872081,\n",
              "          0.0981688 , -0.08360816,  0.30542672,  0.61868332, -0.64398125,\n",
              "          0.05158513, -0.24157526,  0.32097556],\n",
              "        [-0.46866433, -0.41357122, -0.31121112,  0.52014662,  0.09988892,\n",
              "         -0.44949985, -0.45378327,  0.15289683, -0.41917906, -0.40903752,\n",
              "         -0.14318697,  0.46835306,  0.31078681],\n",
              "        [ 0.07351796, -0.00996549,  0.4034731 ,  0.37020754,  0.42154496,\n",
              "          0.22926922, -0.09769035, -0.14141504, -0.57851863, -0.34883053,\n",
              "         -0.08228672, -0.23054915, -0.06895107],\n",
              "        [-0.09980299, -0.16008718, -0.29857519,  0.2692114 ,  0.2312557 ,\n",
              "          0.01167335,  0.1732491 , -0.06629203, -0.48862524,  0.42792689,\n",
              "          0.24709965,  0.36719197,  0.12178018],\n",
              "        [-0.36129717, -0.05228461,  0.34915479,  0.20776528, -0.27341064,\n",
              "         -0.35625668, -0.55003917,  0.17929136, -0.23999497, -0.33471307,\n",
              "          0.06540145,  0.16177496,  0.16568768],\n",
              "        [ 0.25839526,  0.02875837,  0.35328589, -0.2828979 ,  0.19897863,\n",
              "         -0.07175125, -0.07840546,  0.1961446 , -0.31240291, -0.07068377,\n",
              "          0.4371551 , -0.15082955, -0.39502819],\n",
              "        [-0.71211733, -0.45105829,  0.09055191, -0.54270484, -0.4389967 ,\n",
              "         -0.43128515,  0.43525447,  0.05928962, -0.1772805 ,  0.20727368,\n",
              "         -0.19597566, -0.49814992,  0.04429709],\n",
              "        [-0.31082575,  0.56724723,  0.1785033 ,  0.36225892, -0.02966806,\n",
              "          0.11866827, -0.13542777,  0.53273257,  0.59375101,  0.2305926 ,\n",
              "          0.18631897,  0.02867441,  0.04776143],\n",
              "        [ 0.06254693,  0.05113442, -0.20792008, -0.28755515, -0.47665428,\n",
              "         -0.19771998, -0.35104175,  0.17373876,  0.20438888, -0.39431572,\n",
              "          0.36826223,  0.15543067,  0.10755527],\n",
              "        [ 0.133093  ,  0.13670001,  0.21407041, -0.42895613, -0.06092146,\n",
              "         -0.54155397,  0.6462156 ,  0.03284195,  0.03299253,  0.57162515,\n",
              "         -0.47915537, -0.20131514,  0.20086997],\n",
              "        [ 0.20328441,  0.09656436, -0.20794053,  0.19328122, -0.20959119,\n",
              "         -0.12137841,  0.10299315,  0.35152814, -0.30829899, -0.20539943,\n",
              "         -0.32100494,  0.09988057,  0.07559127],\n",
              "        [-0.08442816,  0.26854147,  0.31063054,  0.49678301,  0.21966059,\n",
              "          0.05063459,  0.19125721, -0.01081371,  0.43514542, -0.46794286,\n",
              "          0.07958642, -0.29478825,  0.53555541]]),\n",
              " array([[-0.1744484 ],\n",
              "        [-0.52487849],\n",
              "        [ 0.34105666],\n",
              "        [-0.61658687],\n",
              "        [-0.39939102],\n",
              "        [-0.50942985],\n",
              "        [ 0.73014495],\n",
              "        [-0.5390565 ],\n",
              "        [-0.0347706 ],\n",
              "        [ 0.77768659],\n",
              "        [-0.6162101 ],\n",
              "        [-0.04156005],\n",
              "        [-0.45144156]])]"
            ]
          },
          "metadata": {}
        }
      ],
      "execution_count": 23,
      "metadata": {
        "collapsed": false,
        "outputHidden": false,
        "inputHidden": false
      }
    },
    {
      "cell_type": "code",
      "source": [
        "len(mlp.coefs_[0])"
      ],
      "outputs": [
        {
          "output_type": "execute_result",
          "execution_count": 24,
          "data": {
            "text/plain": [
              "9"
            ]
          },
          "metadata": {}
        }
      ],
      "execution_count": 24,
      "metadata": {
        "collapsed": false,
        "outputHidden": false,
        "inputHidden": false
      }
    },
    {
      "cell_type": "code",
      "source": [
        "mlp.coefs_[0]"
      ],
      "outputs": [
        {
          "output_type": "execute_result",
          "execution_count": 25,
          "data": {
            "text/plain": [
              "array([[-0.1881383 ,  0.06936781,  0.25132071,  0.54200624,  0.24556997,\n",
              "         0.04277295,  0.17382716, -0.46497638, -0.21438311,  0.18281472,\n",
              "         0.15372843, -0.02028545, -0.52916784],\n",
              "       [ 0.21992635, -0.00838443,  0.15562097, -0.40814875, -0.0787755 ,\n",
              "         0.24326174,  0.15224143, -0.34738608, -0.12321794, -0.15675869,\n",
              "         0.03130395, -0.27681512,  0.22712127],\n",
              "       [-0.43183095,  0.19240544, -0.25027285, -0.35697896, -0.17613975,\n",
              "         0.1664433 ,  0.04653116, -0.02330485,  0.54639837,  0.20604981,\n",
              "        -0.18547052,  0.04349312,  0.32171182],\n",
              "       [ 0.07242393, -0.36008638, -0.4151522 , -0.15397501,  0.47022404,\n",
              "        -0.11808914, -0.3989602 ,  0.05111261,  0.01755496, -0.44579156,\n",
              "         0.16990582,  0.22563828,  0.24117851],\n",
              "       [-0.18798663,  0.1655963 , -0.19847794, -0.28466721, -0.03540747,\n",
              "        -0.34743287, -0.23462429,  0.31911658, -0.05346275,  0.48205172,\n",
              "         0.40541368, -0.46273255,  0.0809665 ],\n",
              "       [-0.44612396, -0.11779751,  0.10020353, -0.17426744, -0.13106907,\n",
              "         0.51238328,  0.19844734,  0.24572122,  0.33676495, -0.40597193,\n",
              "        -0.59210846, -0.29130667,  0.05309978],\n",
              "       [-0.12719669, -0.10118277,  0.32934544,  0.20133818,  0.57538665,\n",
              "        -0.04702525,  0.42381986, -0.37421128, -0.21395382, -0.19378841,\n",
              "        -0.21862348,  0.49348208, -0.08246455],\n",
              "       [ 0.48985404, -0.47702491,  0.44618193,  0.47030965,  0.07480942,\n",
              "         0.10374093,  0.08835347,  0.16396706,  0.54979604, -0.39545627,\n",
              "         0.38459468,  0.2303497 ,  0.46847586],\n",
              "       [ 0.52025252,  0.42589767, -0.15763549,  0.03616224, -0.28025657,\n",
              "         0.46085595, -0.40875698,  0.17299327, -0.10760618, -0.22883535,\n",
              "        -0.29307513,  0.58527686, -0.24122097]])"
            ]
          },
          "metadata": {}
        }
      ],
      "execution_count": 25,
      "metadata": {
        "collapsed": false,
        "outputHidden": false,
        "inputHidden": false
      }
    },
    {
      "cell_type": "code",
      "source": [
        "len(mlp.intercepts_[0])"
      ],
      "outputs": [
        {
          "output_type": "execute_result",
          "execution_count": 26,
          "data": {
            "text/plain": [
              "13"
            ]
          },
          "metadata": {}
        }
      ],
      "execution_count": 26,
      "metadata": {
        "collapsed": false,
        "outputHidden": false,
        "inputHidden": false
      }
    },
    {
      "cell_type": "code",
      "source": [
        "mlp.intercepts_[0]"
      ],
      "outputs": [
        {
          "output_type": "execute_result",
          "execution_count": 27,
          "data": {
            "text/plain": [
              "array([-0.48337664,  0.44546505,  0.40579246, -0.13866209, -0.28064258,\n",
              "        0.30188899, -0.13808039, -0.06443187,  0.09557687, -0.44393233,\n",
              "        0.13043914, -0.22763605,  0.29033847])"
            ]
          },
          "metadata": {}
        }
      ],
      "execution_count": 27,
      "metadata": {
        "collapsed": false,
        "outputHidden": false,
        "inputHidden": false
      }
    },
    {
      "cell_type": "code",
      "source": [
        "print(\"weights between input and first hidden layer:\")\n",
        "print(mlp.coefs_[0])\n",
        "print(\"\\nweights between first hidden and second hidden layer:\")\n",
        "print(mlp.coefs_[1])"
      ],
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "weights between input and first hidden layer:\n",
            "[[-0.1881383   0.06936781  0.25132071  0.54200624  0.24556997  0.04277295\n",
            "   0.17382716 -0.46497638 -0.21438311  0.18281472  0.15372843 -0.02028545\n",
            "  -0.52916784]\n",
            " [ 0.21992635 -0.00838443  0.15562097 -0.40814875 -0.0787755   0.24326174\n",
            "   0.15224143 -0.34738608 -0.12321794 -0.15675869  0.03130395 -0.27681512\n",
            "   0.22712127]\n",
            " [-0.43183095  0.19240544 -0.25027285 -0.35697896 -0.17613975  0.1664433\n",
            "   0.04653116 -0.02330485  0.54639837  0.20604981 -0.18547052  0.04349312\n",
            "   0.32171182]\n",
            " [ 0.07242393 -0.36008638 -0.4151522  -0.15397501  0.47022404 -0.11808914\n",
            "  -0.3989602   0.05111261  0.01755496 -0.44579156  0.16990582  0.22563828\n",
            "   0.24117851]\n",
            " [-0.18798663  0.1655963  -0.19847794 -0.28466721 -0.03540747 -0.34743287\n",
            "  -0.23462429  0.31911658 -0.05346275  0.48205172  0.40541368 -0.46273255\n",
            "   0.0809665 ]\n",
            " [-0.44612396 -0.11779751  0.10020353 -0.17426744 -0.13106907  0.51238328\n",
            "   0.19844734  0.24572122  0.33676495 -0.40597193 -0.59210846 -0.29130667\n",
            "   0.05309978]\n",
            " [-0.12719669 -0.10118277  0.32934544  0.20133818  0.57538665 -0.04702525\n",
            "   0.42381986 -0.37421128 -0.21395382 -0.19378841 -0.21862348  0.49348208\n",
            "  -0.08246455]\n",
            " [ 0.48985404 -0.47702491  0.44618193  0.47030965  0.07480942  0.10374093\n",
            "   0.08835347  0.16396706  0.54979604 -0.39545627  0.38459468  0.2303497\n",
            "   0.46847586]\n",
            " [ 0.52025252  0.42589767 -0.15763549  0.03616224 -0.28025657  0.46085595\n",
            "  -0.40875698  0.17299327 -0.10760618 -0.22883535 -0.29307513  0.58527686\n",
            "  -0.24122097]]\n",
            "\n",
            "weights between first hidden and second hidden layer:\n",
            "[[-3.33041431e-02 -3.82462859e-01  3.28140224e-01  4.88777400e-01\n",
            "   3.74743318e-01  5.34059206e-01  3.15309248e-01 -1.21504755e-01\n",
            "  -3.32521642e-02  3.96522849e-01 -8.77913200e-02 -2.55129187e-01\n",
            "   1.90053855e-01]\n",
            " [ 4.30102184e-01 -3.33868396e-02  5.52194843e-01  8.45030748e-03\n",
            "  -3.05733720e-01 -1.01374263e-01 -3.07821372e-01 -3.67957687e-01\n",
            "  -1.36425362e-01 -7.29654127e-02 -4.14776566e-01 -1.58823985e-01\n",
            "   2.45664446e-01]\n",
            " [ 1.54099422e-01 -2.92215767e-01 -4.12575047e-01  3.15957287e-01\n",
            "  -2.68019025e-01  1.40360839e-01  1.55795877e-01 -5.63022418e-02\n",
            "   1.21864966e-01 -4.06520769e-01 -2.96294533e-02  2.69710547e-01\n",
            "  -2.67728318e-01]\n",
            " [-9.69268640e-02  7.77699928e-02  1.64959471e-01  3.51381222e-01\n",
            "   7.19940556e-02  1.17368438e-01 -2.30026401e-01  5.02931367e-02\n",
            "  -2.21901162e-01  2.74982133e-01 -3.55457124e-01 -2.61697188e-01\n",
            "  -2.65973979e-01]\n",
            " [-1.99474701e-01  4.34783644e-01 -8.45541157e-02 -3.67350819e-01\n",
            "   2.65379412e-01 -3.08875811e-01 -2.05661964e-01 -3.70068960e-01\n",
            "   1.95954778e-01  3.14938858e-01  3.81451269e-01  1.82155149e-03\n",
            "   3.88188953e-01]\n",
            " [-1.73982400e-01  2.82603230e-01  2.61254386e-01  5.45487462e-02\n",
            "   1.85353337e-01  7.40853744e-02  4.60435467e-01  5.30170557e-01\n",
            "  -1.32460026e-01  3.46615800e-02 -5.77694262e-02 -5.78738093e-02\n",
            "   2.17286950e-01]\n",
            " [ 5.89351836e-02  5.26625279e-01  5.15720880e-01  2.57686759e-01\n",
            "   4.81657620e-01  5.62868260e-01 -3.61107181e-01  5.79235428e-01\n",
            "   4.04203144e-01  2.72109546e-01  1.01942596e-01 -1.11032655e-01\n",
            "   2.41686190e-02]\n",
            " [ 9.40436177e-02 -3.75564858e-01 -5.41099380e-01  5.13322181e-01\n",
            "  -3.78847574e-01  1.57323753e-01  2.23830225e-02  2.01250864e-01\n",
            "  -2.98224947e-01  4.20853484e-01 -4.17103721e-01  5.00648595e-03\n",
            "   4.07867787e-02]\n",
            " [-1.40957821e-01 -6.41244948e-01 -5.65683780e-01 -9.27191233e-02\n",
            "  -3.87349107e-01 -5.45577481e-01 -6.53884609e-02 -2.34806478e-01\n",
            "   1.47277905e-01 -4.93654125e-01 -4.83324550e-02  2.64270795e-01\n",
            "  -2.83882938e-03]\n",
            " [-1.98926254e-01 -1.19599261e-02 -5.19125722e-01 -2.22218359e-01\n",
            "   5.02628492e-01  3.11542356e-03  7.65483880e-02  4.17186539e-01\n",
            "  -1.69080276e-01 -1.89604707e-02  5.35722336e-01  1.43494026e-01\n",
            "  -6.63124830e-02]\n",
            " [-8.74293986e-02 -3.88650038e-01  4.50860734e-01  3.52654026e-01\n",
            "   1.97759973e-01  1.78161191e-04  2.31705858e-02 -4.15325827e-02\n",
            "  -3.87992815e-01 -1.45002598e-01  1.20536482e-01  4.17073677e-01\n",
            "  -5.53370090e-01]\n",
            " [ 4.38139332e-01  8.98992813e-02 -3.54257506e-01  2.07339884e-01\n",
            "  -2.96225251e-01  1.57269765e-01  8.01088226e-02  4.15375602e-01\n",
            "  -5.13990633e-01  4.51924353e-01  5.68026139e-01  2.11889744e-01\n",
            "  -2.85594110e-01]\n",
            " [-4.32888234e-01  1.82403666e-01  5.32110039e-02  3.40620206e-01\n",
            "   4.26118415e-01 -3.36927027e-01  4.16989216e-01 -1.04336300e-01\n",
            "  -4.62402272e-02  3.63931938e-01 -1.19642176e-02  2.16019478e-02\n",
            "  -2.53679703e-01]]\n"
          ]
        }
      ],
      "execution_count": 30,
      "metadata": {
        "collapsed": false,
        "outputHidden": false,
        "inputHidden": false
      }
    },
    {
      "cell_type": "code",
      "source": [
        "print(\"w0 = \", mlp.coefs_[0][0][0])\n",
        "print(\"w1 = \", mlp.coefs_[0][1][0])"
      ],
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "w0 =  -0.18813830107912635\n",
            "w1 =  0.21992634931338156\n"
          ]
        }
      ],
      "execution_count": 32,
      "metadata": {
        "collapsed": false,
        "outputHidden": false,
        "inputHidden": false
      }
    },
    {
      "cell_type": "code",
      "source": [
        "print(\"Bias values for first hidden layer:\")\n",
        "print(mlp.intercepts_[0])\n",
        "print(mlp.intercepts_[1])"
      ],
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "Bias values for first hidden layer:\n",
            "[-0.48337664  0.44546505  0.40579246 -0.13866209 -0.28064258  0.30188899\n",
            " -0.13808039 -0.06443187  0.09557687 -0.44393233  0.13043914 -0.22763605\n",
            "  0.29033847]\n",
            "\n",
            "Bias values for second hidden layer:\n",
            "[-0.10386124 -0.36627652  0.11530672 -0.1511756  -0.50311608 -0.10249083\n",
            "  0.31587765 -0.46692696  0.19410117 -0.41689523  0.52862756 -0.5506964\n",
            "  0.44603973]\n"
          ]
        }
      ],
      "execution_count": 33,
      "metadata": {
        "collapsed": false,
        "outputHidden": false,
        "inputHidden": false
      }
    }
  ],
  "metadata": {
    "kernel_info": {
      "name": "python3"
    },
    "language_info": {
      "version": "3.5.5",
      "mimetype": "text/x-python",
      "file_extension": ".py",
      "codemirror_mode": {
        "version": 3,
        "name": "ipython"
      },
      "pygments_lexer": "ipython3",
      "nbconvert_exporter": "python",
      "name": "python"
    },
    "kernelspec": {
      "name": "python3",
      "language": "python",
      "display_name": "Python 3"
    },
    "nteract": {
      "version": "0.15.0"
    }
  },
  "nbformat": 4,
  "nbformat_minor": 4
}